// 设置默认信息
$.validator.setDefaults({
  submitHandler: function (val) {
        oktipsoption = {
            type: 1,
            url: $('.formsub').attr('url'),
            msg: '提交成功'
        };
        ajaxform.init(oktipsoption, '.formsub');
        ajaxform.submit();
    },
    errorPlacement: function (error, element) {
        element.parents('td').append(error);
    }
});

$(document).ready(function($) {
    //组织机构代码
    var record;
    $("#r_cust_orgn_code").on('keyup', function () {
        var myThis = $(this);
        var val = myThis.val();
        var decimalReg = /[^a-z0-9A-Z^\uFF00-\uFFFF-^]/g;
        if (val != '' && decimalReg.test(val)) {
            myThis.val(record);
        } else {
            if (val != '') {
                record = val;
            }
        }
        myThis.blur(function () {
            record = '';
        });
    });

     $("#sureeferee").validate({
        rules: {
            r_cust_orgn_code: {
                required: true,
                maxlength:10
            }
        },
        messages: {
            r_cust_orgn_code: {
                required: '请输入核心企业的组织机构号',
                maxlength:'组织机构代码不超过10位'
            }
        },
        focusInvalid: false,
        onkeyup: false
    });
});